<template>
  <a-modal
    :title="title"
    :width="800"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    :footer="null"
    cancelText="关闭">

    <table id="table_report" class="table table-striped table-bordered table-hover">
      <tr>
        <td style="width:90px;text-align: center;padding-top: 80px;">基本信息:</td>
        <td>
          <p style="float: left;">
            停车场编号:<span id="parkCode">
           {{ result.parkCode }}
                    </span><br>
            停车场名称:<span id="parkName">
           {{ result.parkName }}
                    </span><br>
            车牌号:<span id="vehicleNum">
           {{ result.vehicleNum }}
                    </span><br>
            交易日期:<span id="tdate">
           {{ result.tdate }}
                    </span><br>
            O2O交易方式:<span
            id="o2oPaymode">
           {{ result.o2oPaymode }}
                    </span><br>
            调用接口名称:<span id="consumerId">
           {{ result.consumerId }}
                    </span><br>
            订单号（工行）:<span id="orderNo">
           {{ result.orderNo }}
                    </span><br>
            创建时间:<span id="createTime">
           {{ result.createTime }}
                    </span><br>
          </p>
        </td>
      </tr>

      <tr>
        <td style="width:90px;text-align: center;padding-top: 220px;">详情:</td>
        <td>
          <p style="float: left;">
            返回码:<span id="returnCode">
           {{ result.returnCode }}
                    </span><br>

            返回码说明:<span id="returnMsg">
           {{ result.returnMsg }}
                    </span><br>

            订单金额:<span id="orderSum">
           {{ result.orderSum }}
                    </span><br>
            订单提交日期:<span id="sdate">
           {{ result.sdate }}
                    </span><br>
            订单提交时间:<span id="stime">
           {{ result.stime }}
                    </span><br>
            交易时间戳:<span id="trtimesp">
           {{ result.trtimesp }}
                    </span><br>
            交易时间:<span id="ttime">
           {{ result.ttime }}
                    </span><br>
            B2c收费额:<span id="csum">
           {{ result.csum }}
                    </span><br>
            银联交易流水号:<span id="ctrxSerno">
           {{ result.ctrxSerno }}
                    </span><br>
            特约单位编号:<span id="merno">
           {{ result.merno }}
                    </span><br>
            付款行行号:<span id="thbankno">
           {{ result.thbankno }}
                    </span><br>
            优惠金额:<span id="yhAmt">
           {{ result.yhAmt }}
                    </span><br>
            银行补贴金额:<span id="btAmt">
           {{ result.btAmt }}
                    </span><br>
            商户补贴金额:<span id="mbtAmt">
           {{ result.mbtAmt }}
                    </span><br>

            是否使用电子券:<span id="dzqFlag">
           {{ result.dzqFlag }}
                    </span><br>


            已优惠金额:<span id="disAmt">
           {{ result.disAmt }}
                    </span><br>


            商品金额:<span id="totAmt">
           {{ result.totAmt }}
                    </span><br>


            电子券抵扣金额:<span id="dzqAmt">
           {{ result.dzqAmt }}
                    </span><br>


            累计电子券退货金额:<span id="rjdzqAmt">
           {{ result.rjdzqAmt }}
                    </span><br>


            已兑换金额:<span id="usedAmt">
           {{ result.usedAmt }}
                    </span><br>


            电子券ID:<span id="dzqId">
           {{ result.dzqId }}
                    </span><br>

            订单查询日期时间<span id="queryTime">
           {{ result.queryTime }}
                    </span><br>
          </p>
        </td>
      </tr>

      <tr>
        <td style="text-align: center;" colspan="10">
          <a-button type="primary" @click="close">关闭</a-button>
        </td>
      </tr>
    </table>

  </a-modal>
</template>

<script>
import {httpAction} from '@/api/manage'
import pick from 'lodash.pick'
import moment from "moment"

export default {
  name: "B2cOrderqrySearchV1LogModal",
  data() {
    return {
      title: "操作",
      visible: false,
      model: {},
      labelCol: {
        xs: {span: 24},
        sm: {span: 5},
      },
      wrapperCol: {
        xs: {span: 24},
        sm: {span: 16},
      },
      result: {},
      confirmLoading: false,
      form: this.$form.createForm(this),
      validatorRules: {},
      url: {
        add: "/b2cpaymentpay/b2cOrderqrySearchV1Log/add",
        edit: "/b2cpaymentpay/b2cOrderqrySearchV1Log/edit",
      },
    }
  },
  created() {
  },

  methods: {
    add() {
      this.edit({});
    },
    edit(record) {
      switch (record.o2oPaymode) {
        case '0':
          record.o2oPaymode = '其他'
          break
        case '1':
          record.o2oPaymode = 'e生活扫描商户二维码'
          break
        case '2':
          record.o2oPaymode = 'e生活扫描订单二维码'
          break
        case '3':
          record.o2oPaymode = '工银e生活买单'
          break
        case '4':
          record.o2oPaymode = '融e联扫描商户二维码'
          break
        case '5':
          record.o2oPaymode = '融e联扫描订单二维码'
          break
        case '6':
          record.o2oPaymode = 'pos扫码付款'
          break
        case '7':
          record.o2oPaymode = '商户之家扫码付款'
          break
        case '8':
          record.o2oPaymode = '团购'
          break
        case '9':
          record.o2oPaymode = '融e行主扫商户二维码'
          break
        case '10':
          record.o2oPaymode = '融e行主扫订单二维码'
          break
        case '11':
          record.o2oPaymode = '融e行pos扫码付款'
          break
        case '12':
          record.o2oPaymode = '融e行商户之家扫码付款'
          break
        case '13':
          record.o2oPaymode = '微信扫商户二维码'
          break
        case '14':
          record.o2oPaymode = '微信扫订单二维码'
          break
        case '15':
          record.o2oPaymode = 'POS/MIS 扫描微信二维码'
          break
        case '16':
          record.o2oPaymode = '商户之家扫描微信二维码'
          break
        case '17':
          record.o2oPaymode = '银联商户扫描付款'
          break
        case '18':
          record.o2oPaymode = '银联商户扫码付款（融e行）'
          break
        case '19':
          record.o2oPaymode = 'P OS扫码付款（e生活）'
          break
        case '20':
          record.o2oPaymode = '商户之家扫码付款（e生活）'
          break
        case '21':
          record.o2oPaymode = '银联商户扫码付款（e生活）'
          break
        case '22':
          record.o2oPaymode = '支付宝扫描商户二维码'
          break
        case '23':
          record.o2oPaymode = '支付宝扫描订单二维码'
          break
        case '24':
          record.o2oPaymode = 'POS/MIS扫描支付宝二维码'
          break
        case '25':
          record.o2oPaymode = '商户之家扫描支付宝二维码'
          break
        case '26':
          record.o2oPaymode = 'POS扫银联二维码'
          break
        case '27':
          record.o2oPaymode = '商户之家扫银联二维码'
          break
        case '28':
          record.o2oPaymode = '融e行扫描境外商户二维码'
          break
        case '29':
          record.o2oPaymode = '线上聚合支付（微信）'
          break
        case '30':
          record.o2oPaymode = '线上聚合支付（支付宝）'
          break
        case '31':
          record.o2oPaymode = '银联渠道扫描商户二维码'
          break
        case '32':
          record.o2oPaymode = '银联渠道扫描订单二维码'
          break
        case '33':
          record.o2oPaymode = '融e行扫银联二维码'
          break
        case '34':
          record.o2oPaymode = '融e联扫银联二维码'
          break
        case '35':
          record.o2oPaymode = 'e生活扫银联二维码'
          break
      }
      switch (record.secorderFlag) {
        case "0":
          record.secorderFlag = '否'
          break
        case "1":
          record.secorderFlag = '是'
          break
      }
      switch (record.payType) {
        case '0001':
          record.payType = '认证支付'
          break
        case '0002':
          record.payType = '快捷支付'
          break
        case'0003':
          record.payType = '小额支付'
          break
        case '0004':
          record.payType = '储值卡支付'
          break
        case'0005':
          record.payType = 'IC卡支付'
          break
        case '0006':
          record.payType = '实名支付'
          break
        case'0201':
          record.payType = '网银支付'
          break
        case '1001':
          record.payType = '牡丹畅通卡支付'
          break
        case '1002':
          record.payType = '中铁银通卡支付'
          break
        case '0401':
          record.payType = '信用卡支付——暂定'
          break
        case '0402':
          record.payType = '小额临时支付'
          break
        case '0403':
          record.payType = '认证支付'
          break
        case '2.00404':
          record.payType = '互联网订单手机支付'
          break
        case '9000':
          record.payType = '其他无卡支付(如手机客户端支付)'
          break
        case '0101':
          record.payType = '账户绑定验证'
          break
        case '0102':
          record.payType = '银联认证支付开通验证'
          break
        case '0103':
          record.payType = '小额支付开通验证'
          break
      }
      Object.assign(this.result, record);
      this.visible = true;
    },
    close() {
      this.$emit('close');
      this.visible = false;
    },
    handleOk() {
      const that = this;
      // 触发表单验证
      this.form.validateFields((err, values) => {
        if (!err) {
          that.confirmLoading = true;
          let httpurl = '';
          let method = '';
          if (!this.model.id) {
            httpurl += this.url.add;
            method = 'post';
          } else {
            httpurl += this.url.edit;
            method = 'put';
          }
          let formData = Object.assign(this.model, values);
          //时间格式化

          httpAction(httpurl, formData, method).then((res) => {
            if (res.success) {
              that.$message.success(res.message);
              that.$emit('ok');
            } else {
              that.$message.warning(res.message);
            }
          }).finally(() => {
            that.confirmLoading = false;
            that.close();
          })


        }
      })
    },
    handleCancel() {
      this.close()
    },


  }
}
</script>

<style lang="less" scoped>

</style>